Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | 1x 5x 5x 5x 5x 5x 5x 5x 2x 3x 2x 1x 1x | import { NextRequest, NextResponse } from "next/server";
import { edcClient } from "@/lib/edc";
import { requireAuth, isAuthError } from "@/lib/auth-guard";
export const dynamic = "force-dynamic";
/**
* PATCH /api/participants/[id] — Update tenant properties (display name,
* contact details, etc.) via CFM TenantManager.
*/
export async function PATCH(
req: NextRequest,
{ params }: { params: Promise<{ id: string }> },
) {
const auth = await requireAuth();
Iif (isAuthError(auth)) return auth;
try {
const { id } = await params;
const body = await req.json();
const { properties } = body as { properties: Record<string, string> };
if (!properties || typeof properties !== "object") {
return NextResponse.json(
{ error: "Missing properties" },
{ status: 400 },
);
}
const result = await edcClient.tenant(`/v1alpha1/tenants/${id}`, "PATCH", {
properties,
});
return NextResponse.json(result ?? { ok: true });
} catch (err) {
console.error("Failed to PATCH tenant:", err);
return NextResponse.json(
{ error: "Failed to update participant" },
{ status: 502 },
);
}
}
|